package interaction.game;

import processing.core.*;

import java.awt.Rectangle;
import java.util.Random;

public class ForegroundItem extends LoopingGameObject {
	private Hero hero;
	
	public ForegroundItem(PImage image, PVector position, PVector velocity, int loopDistance, Hero hero) {
		super(image, position, velocity, loopDistance);
		this.hero = hero;
	}
	
	public Hero getHero()
	{
		return hero;
	}
	
	public PVector getHeroVelocity()
	{
		return hero.getVelocity();
	}
	
	public void update()
	{
		PVector velocity = getVelocity();
		getPosition().x -= getHeroVelocity().x;
		getPosition().y += velocity.y;
	}
	
	public boolean intersectsWithHero()
	{
		return getHero().getBounds().intersects(getBounds());
	}
}
